import Vue from "vue";
import Vuex from "vuex";
import { getAllPro } from "../api/request";

Vue.use(Vuex);

export default new Vuex.Store({
    //数据，相当于data
    state: {
        shop: {},
    },
    actions: {
        getShop(ctx) {
            getAllPro("/shop").then((res) => {
                ctx.state.shop = res.data;
                ctx.commit("GetShop", res.data);
            });
        },
    },
    mutations: {
        GetShop(state , value) {
            // console.log(value);
        }
    },
    modules: {},
    getters: {},
});
